const {
	Controller
} = require("uni-cloud-router");
/* const {
	getUserInfo
} = require("user-info"); */

module.exports = class WmzAdverCateringController extends(
	Controller
) {
	async wxAdverInit(event, context) {
		// let uniIdToken = event.event.uniIdToken
		// let userInfo = await getUserInfo(uniIdToken)
		let data = event.data
		let shopId = data.shopId,
			appId = data.appId,
			adunitList = data.adunitList
		return this.service.wmzAdverCatering.wxAdverInit(shopId, appId, adunitList)
	}

	async adverShopConfigGet(event, context) { 
		let data = event.data
		let shopId = data.shopId,
			appId = data.appId,
			projectCode = "wmz_catering",
			adProvider = data.adProvider
		return this.service.wmzAdverCatering.adverShopConfigGet(projectCode, adProvider, shopId, appId)
	}

	async advertisingCheckCanOpenWx(event){
		let data = event.data
		let appId = data.appId
		return this.service.wmzAdverCatering.advertisingCheckCanOpenWxService(appId)
	}

	async advertisingAdunitInit(event){
		let data = event.data
		let shopId = data.shopId,
			appId = data.appId
		return this.service.wmzAdverCatering.advertisingAdunitInitWxService(appId, shopId)
	}


	async timedTask(event){
		let data = event.data
		return this.service.wmzAdverCatering.timedTaskService()
	}
};
